package com.example.lushudao_admin.mapper;

import com.example.lushudao_admin.entity.*;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AdminMapper {

    void updateAdmin(int admin_id, String admin_name, String admin_acc,String admin_pwd);
    List<Admin> findOneAdmin(int admin_id);
    List<Admin> createAdmin();
    void delOneAdmin(int admin_id);
    List<Admin> login(String admin_acc , String admin_pwd);
    Admin loginCheckUserAcc(String admin_acc );
    List<User> getUserLimit(int start, int end);
    List<User> getAdminLimit(int start,int end);
    List<UserRelease> userReleaseList(int start, int end);
    List<ScenicInfo> scenicList(int start, int end);
    List<User> userList(int start, int end);
    List<Comment> userCommentList(int start, int end);
    List<InfoManager> infoManageList(int start, int end);
    List<InfoManager> stytemManageList(int start, int end);

    @Select("select count(comment_id) as id from roam_comment")
    PageCount selectUserCommentPageCount();

    @Select("select count(scenic_id) as id from roam_scenic")
    PageCount  selectScenicListPageCount();

    @Select("select count(scenic_release_id) as id from scenic_release_info")
    PageCount  selectScenicRelaseListPageCount();

    @Select("select count(user_id) as id from roam_user_info")
    PageCount  selectUserPageCount();

    @Select("select count(admin_id) as id from roam_admin_info where admin_role =1 and admin_perms=1")
    PageCount  selectInfoAdminPageCount();

    @Select("select count(admin_id) as id from roam_admin_info where admin_role =1 and admin_perms=2")
    PageCount selectSystemAdminPageCount();


    @Delete("delete FROM `roam_user_info` WHERE `user_id` = #{user_id}")
    void delectUser(int user_id);

    @Delete("delete FROM `scenic_release_info` WHERE `scenic_release_id` =  #{scenic_release_id}")
    void delectUserRelease(int scenic_release_id);

    @Delete("delete FROM `roam_comment` WHERE `comment_id` =  #{comment_id}")
    void delectUserComment(int comment_id);

    @Delete("delete FROM `roam_scenic` WHERE `scenic_id` =  #{scenic_id}")
    void delectScenic(int scenic_id);

    @Delete("delete FROM `roam_admin_info` WHERE `admin_id` = #{admin_id}")
    void delectAdmin(int admin_id);



}
